package com.choosefine.it.payment.service;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.choosefine.it.common.enums.TradeStatus;
import com.choosefine.it.payment.dao.TradeFlowMapper;
import com.choosefine.it.payment.model.TradeFlow;

/**
 * Comments：交易流水service服务
 * Author：DengYouyi
 * Create Date：2017年3月11日
 * Modified By：
 * Modified Date：
 * Why & What is modified：
 * Version：v1.0
 */
@Service
public class TradeFlowService {
	@Autowired
	TradeFlowMapper tradeFlowMapper;
	
	
	public int insert (TradeFlow model){
		model.setCtime(new Date().getTime());
		model.setStatus(TradeStatus.WAITPAY.getValue());
		return tradeFlowMapper.insert(model);
	}

	public int update (TradeFlow model){
		model.setUtime(new Date().getTime());
		return tradeFlowMapper.update(model);
	}
	
	
	public List<TradeFlow> findByCondition(TradeFlow model){
		return tradeFlowMapper.findByCondition(model);
	}
	
}
